From fade0afbefae454e3b859c428f6df85c91ce8d4d Mon Sep 17 00:00:00 2001 From: =?utf8?q?Timm=20B=C3=A4der?= Date: Mon, 27 Aug 2018 18:45:03 +0200 Subject: [PATCH] box: Simplify compute_size_for_orientation --- gtk/gtkbox.c | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-) diff --git a/gtk/gtkbox.c b/gtk/gtkbox.c index fd0ebbb573..960bef0502 100644 --- a/gtk/gtkbox.c +++ b/gtk/gtkbox.c @@ -1180,16 +1180,16 @@ gtk_box_compute_size_for_opposing_orientation (GtkBox *box, static void gtk_box_compute_size_for_orientation (GtkBox *box, - gint avail_size, - gint *minimum_size, - gint *natural_size) + int avail_size, + int *minimum_size, + int *natural_size) { GtkBoxPrivate *priv = gtk_box_get_instance_private (box); GtkWidget *child; - gint nvis_children = 0; - gint required_size = 0, required_natural = 0, child_size, child_natural; - gint largest_child = 0, largest_natural = 0; - gint spacing = get_spacing (box); + const int spacing = get_spacing (box); + int nvis_children = 0; + int required_size = 0, required_natural = 0; + int largest_child = 0, largest_natural = 0; for (child = gtk_widget_get_first_child (GTK_WIDGET (box)); child != NULL; @@ -1197,6 +1197,7 @@ gtk_box_compute_size_for_orientation (GtkBox *box, { if (_gtk_widget_get_visible (child)) { + int child_size, child_natural; gtk_widget_measure (child, priv->orientation, @@ -1204,11 +1205,8 @@ gtk_box_compute_size_for_orientation (GtkBox *box, &child_size, &child_natural, NULL, NULL); - if (child_size > largest_child) - largest_child = child_size; - - if (child_natural > largest_natural) - largest_natural = child_natural; + largest_child = MAX (largest_child, child_size); + largest_natural = MAX (largest_natural, child_natural); required_size += child_size; required_natural += child_natural; -- 2.30.2